function f= expmu(theta2,v,x2,p)
%This function returns a matrix with exp(mu) values for all consumers (columns)
%with respect to all products (rows)

numobs=length(p); 
ns=length(v);   

alpha=theta2(1,1); 
sigma=theta2(1,2:end-1); 
sigmap=theta2(1,end); 
alphai=alpha+sigmap*repmat(v(1,:),numobs,1);  

%alphai=alpha+sigmap*repmat(vp,numobs,1);  

mu=zeros(numobs,ns);

if isempty(sigma)
    temp=exp(mu-alphai.*repmat(p,1,ns));  
else
    for i=1:length(sigma)
    mu=mu+sigma(1,i)*repmat(x2(:,i),1,ns).*repmat(v(i+1,:),numobs,1);
    end
    temp=exp(mu-alphai.*repmat(p,1,ns));
end
f=temp; 
